package com.pacy.pacybaseproject.activitys;

import androidx.appcompat.app.AppCompatActivity;

import android.graphics.Color;
import android.os.Bundle;
import android.util.TypedValue;

import com.flyco.tablayout.listener.CustomTabEntity;
import com.flyco.tablayout.listener.OnTabSelectListener;
import com.fondesa.recyclerviewdivider.DividerBuilder;
import com.pacy.pacybaseproject.BR;
import com.pacy.pacybaseproject.R;
import com.pacy.pacybaseproject.base.BaseXActivity;
import com.pacy.pacybaseproject.beans.TabBean;
import com.pacy.pacybaseproject.databinding.ActivityRedempPointsExPayBinding;
import com.pacy.pacybaseproject.viewmodels.RedempPointsExPayViewModel;

import java.util.ArrayList;

/**
 * 积分线下合作门店
 */
public class RedempPointsExPayActivity extends BaseXActivity<ActivityRedempPointsExPayBinding, RedempPointsExPayViewModel> {
    private ArrayList<CustomTabEntity> tabs = new ArrayList<>();
    @Override
    public int initContentView(Bundle savedInstanceState) {
        return R.layout.activity_redemp_points_ex_pay;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }

    @Override
    public void initData() {
        super.initData();
        setToolbar(binding.baseToolBar);
        if (binding.recyclerView.getItemDecorationCount() == 0) {
            new DividerBuilder(RedempPointsExPayActivity.this)
                    .size(10, TypedValue.COMPLEX_UNIT_DIP)
                    .color(Color.TRANSPARENT)
                    .showFirstDivider()
                    .showLastDivider()
                    .build().addTo(binding.recyclerView);
        }
        initTab();
    }

    private void initTab(){
        tabs.add(new TabBean("附近"));
        tabs.add(new TabBean("酒店"));
        tabs.add(new TabBean("美食"));
        tabs.add(new TabBean("服饰"));
        tabs.add(new TabBean("便利店"));
        binding.tabLayout.setTabData(tabs);
        binding.tabLayout.setCurrentTab(0);
        binding.tabLayout.setOnTabSelectListener(new OnTabSelectListener() {
            @Override
            public void onTabSelect(int position) {
            }

            @Override
            public void onTabReselect(int position) {

            }
        });
    }
}